package beans;

import ourImage.OurPlanarImage;
import ourfilter.ROIFilter;
import pimpmypipe.interfaces.Readable;

/**
 *
 * @author Meraner Marcel
 */
public class ROIFilterBean extends FilterBaseBean<ROIFilter> {

    private int _x = 0;
    private int _y = 40;
    private int _width = 430;
    private int _height = 80;
    private boolean _filterEnabled = false;

    public int getX() {
        return _x;
    }

    public void setX(int x) {
        if ((_x != x) && (x > 1)) {
            _x = x;
            filteringAndNotify();
        }
    }

    public int getY() {
        return _y;
    }

    public void setY(int y) {
        if ((_y != y) && (y > 1)) {
            _y = y;
            filteringAndNotify();
        }
    }

    public int getWidth() {
        return _width;
    }

    public void setWidth(int width) {
        if ((_width != width) && (width > 1)) {
            _width = width;
            filteringAndNotify();
        }
    }

    public int getHeight() {
        return _height;
    }

    public void setHeight(int height) {
        if ((_height != height) && (height > 1)) {
            _height = height;
            filteringAndNotify();
        }
    }

    @Override
    public boolean isFilterEnabled() {
        return _filterEnabled;
    }

    public void setFilterEnabled(boolean enabled) {
        if (enabled != _filterEnabled) {
            _filterEnabled = enabled;
            filteringAndNotify();
        }
    }
    
    @Override
    protected ROIFilter getConcreteFilter(Readable<OurPlanarImage> in) {
        return new ROIFilter(in, this);
    }

    @Override
    protected ROIFilter configureConcreteFilter(ROIFilter filter) {
        filter.setROI(_x, _y, _width, _height);
        filter.setFilterEnabled(_filterEnabled);
        return filter;
    }

    @Override
    public String getFilterName() {
        return "ROI Filter";
    }

    
}
